package com.zeyigou.manager.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zeyigou.pojo.PageResult;
import com.zeyigou.pojo.TbBrand;
import com.zeyigou.sellergoods.service.BrandService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("brand")
public class BrandController {
    @Reference
    private BrandService brandService;
    //1.查询所有品牌
    @RequestMapping("list")
    public List<TbBrand> findAll(){
        System.out.println(brandService.findAll());
        return brandService.findAll();

    }

    //2.分页查询
    @RequestMapping("findByPage")
    public PageResult<TbBrand> findByPage(@RequestParam(required = true,defaultValue = "1") int page, int pageSize){
        return brandService.findBypage(page,pageSize);
    }
}
